package com.example.cqh_votesys.controller;

import com.example.cqh_votesys.pojo.pojo.EnterPrice;
import com.example.cqh_votesys.pojo.result.Result;
import com.example.cqh_votesys.sevice.EnterpriseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: pollux
 * @CreateTime: 2024-06-30
 * @Description: 企业控制类
 * @Version: 1.0
 */


@Slf4j
@RequestMapping("enterprise")
@RestController
@CrossOrigin(origins = "*")
public class EnterPriseController {

    @Autowired
    private EnterpriseService enterpriseService;
    /**
     *
     * @description: 获取企业列表
     * @return: com.example.cqh_votesys.pojo.result.Result<com.example.cqh_votesys.pojo.pojo.EnterPrice>
     * @author: pollux
     * @date: 2024/6/30 17:15
     */
    @GetMapping("/list")
    public Result<EnterPrice[]> getEnterPrise(){
        log.info("获取企业信息接口");
        EnterPrice[] enterPrises =  enterpriseService.getEnterpriseList();
        return Result.success(enterPrises);
    }

}












